import WYapi from "@/utils/request";
//#region 节目列表接扣
interface trackInfoModel {
	id: number;

	title: string;

	intro: string;

	albumId: number;

	albumTitle: string;

	anchorId: number;

	trackType: number;

	relateId: number;

	isPaid: boolean;

	isFree: boolean;

	isTrailer: number;

	cover: string;

	duration: number;

	sampleDuration: number;

	isHoldCopyright: boolean;

	price: string;

	discountedPrice: string;

	createdAt: string;

	iting: string;

	playPath: string;

	createdTime: number;

	updatedTime: number;

	isVipFirst: boolean;

	isOffline: boolean;

	paidType: number;

	auditStatus: number;

	isXimiFirst: boolean;
	categoryId: number;

	isVideo: boolean;

	opType: number;

	visibleCrowdType: number;

	createDateFormat: string;

	tag: number;
}
interface playInfoModel {
	id: number;
	isPaid: boolean;
	isFree: boolean;
	userPermission: boolean;
}
interface statCountInfoModel {
	id: number;
	playCount: number;
	commentCount: number;
}
interface pageUriInfoModel {
	id: number;
	categoryId: number;
	categoryName: string;
	categoryCode: string;
	pinyin: string;
	url: string;
}

export interface ProgramModel {
	id: number;
	trackType: number;
	trackInfo: trackInfoModel;
	playInfo: playInfoModel;
	baiduMusicUrl: string;
	statCountInfo: statCountInfoModel;
	pageUriInfo: pageUriInfoModel;
}
export interface programListModel {
	context: any;
	data: {
		id: number;
		totalCount: number;
		page: number;
		pageSize: number;
		trackDetailInfos: ProgramModel[];
	};
	ret: number;
}
//#endregion

//#region  主播信息 ts leixing
interface userInfoModel {
	ret: number;
	data: dataModel;
	context: Context;
}

interface Context {
	basicRequestContext: BasicRequestContext;
}

interface BasicRequestContext {
	isHybrid: boolean;
	isEmbedded3rdPartner: boolean;
	isKnowAmbassadorDistributor: boolean;
	isM2WapHost: boolean;
}

export interface dataModel {
	id: number;
	userInfo: UserInfo;
	statCountInfo: StatCountInfo;
	url: string;
}

interface StatCountInfo {
	id: number;
	followerCount: number;
}

export interface UserInfo {
	id: number;
	nickname: string;
	isVip: boolean;
	logo: string;
	verifyStatus: number;
	verifyType: number;
	anchorGrade: number;
	userGrade: number;
	personDescribe: string;
	personalSignature: string;
	ptitle: string;
	mobileBackgroundPic: string;
	isLoginBan: boolean;
}
//#endregion

//#region 主播作品
interface userworkModel {
	ret: number;
	data: userDataModel;
	context: Context;
}

interface Context {
	basicRequestContext: BasicRequestContext;
}

interface BasicRequestContext {
	isHybrid: boolean;
	isEmbedded3rdPartner: boolean;
	isKnowAmbassadorDistributor: boolean;
	isM2WapHost: boolean;
}

export interface userDataModel {
	page: number;
	pageSize: number;
	totalCount: number;
	albumBriefDetailInfos: AlbumBriefDetailInfo[];
}

interface AlbumBriefDetailInfo {
	id: number;
	albumInfo: AlbumInfo;
	statCountInfo: StatCountInfo;
	pageUriInfo: PageUriInfo;
}

interface PageUriInfo {
	id: number;
	categoryId: number;
	categoryName: string;
	categoryCode: string;
	pinyin: string;
	url: string;
}

interface StatCountInfo {
	id: number;
	playCount: number;
	trackCount: number;
}

interface AlbumInfo {
	id: number;
	cover: string;
	title: string;
	customTitle: string;
	shortIntro: string;
	salePoint: string;
	recommendReason?: string;
	albumTag: number;
	albumFinishTag: number;
	albumPreferTag: number;
	albumType: number;
	albumPayType: number;
	albumVipPayType: number;
	isVipFirst: boolean;
	status: number;
	categoryId: number;
}
//#endregion

//#region 用户评论
interface commentModel {
	ret: number;
	data: commentDataModel;
	context: Context;
}

interface Context {
	basicRequestContext: BasicRequestContext;
}

interface BasicRequestContext {
	isHybrid: boolean;
	isEmbedded3rdPartner: boolean;
	isKnowAmbassadorDistributor: boolean;
	isM2WapHost: boolean;
}

export interface commentDataModel {
	albumId: number;
	page: number;
	pageSize: number;
	totalCount: number;
	comments: Comment[];
}

interface Comment {
	id: number;
	uid: number;
	nickname: string;
	smallHeader: string;
	content: string;
	albumScore: number;
	likes: number;
	createdAt: number;
	updatedAt: number;
}
//#endregion

//#region 相似专辑

interface AlbumModel {
	ret: number;
	data: AlbumDataModel;
}

export interface AlbumDataModel {
	illegal: boolean;
	kw: string;
	album: Album;
	seo: Seo;
}

interface Seo {
	trackTitle: string;
	intro: string;
}

interface Album {
	docs: Doc[];
	pageSize: number;
	currentPage: number;
	sc: Sc;
	total: number;
	totalPage: number;
	index: number;
}

interface Sc {}

interface Doc {
	playCount: number;
	coverPath: string;
	title: string;
	uid: number;
	url: string;
	categoryPinyin: string;
	categoryId: number;
	intro: string;
	albumId: number;
	isPaid: boolean;
	isFinished: number;
	createdAt: number;
	updatedAt: number;
	isVipFree: boolean;
	nickname: string;
	anchorPic: string;
	verifyType: number;
	vipFreeType: number;
	tracksCount: number;
	priceTypes: any[];
	anchorUrl: string;
	richTitle: string;
	vipType: number;
	albumSubscript: number;
}
//#endregion

//#region 猜你喜欢列表
interface LikeListModel {
	ret: number;
	data: LikeListDataModel;
}

export interface LikeListDataModel {
	currentUid: number;
	total: number;
	pageNum: number;
	pageSize: number;
	albums: Album[];
}

interface Album {
	albumId: number;
	albumPlayCount: number;
	albumTrackCount: number;
	albumCoverPath: string;
	albumTitle: string;
	albumUserNickName: string;
	anchorId: number;
	anchorGrade: number;
	mvpGrade: number;
	isDeleted: boolean;
	isPaid: boolean;
	isFinished: number;
	anchorUrl: string;
	albumUrl: string;
	intro: string;
	vipType: number;
	logoType: number;
	albumSubscript: number;
}
//#endregion
//课程详情api接口
//头部和内容简介
export const reqHeadInfo = (id: number) => {
	return WYapi.get<any, any>(
		`/m-revision/page/album/v2/queryAlbumPage/${id}?albumCounts=track&v=1678361487487`,
	);
};
// 节目列表
export const reqProgramList = (albumId: any) => {
	return WYapi.get<any, programListModel>(
		`/m-revision/common/album/queryAlbumTrackRecordsByPage?albumId=${albumId}&page=1&pageSize=10&asc=true&countKeys=play%2Ccomment&v=1678361487607`,
	);
};
// 主播信息 https://m.ximalaya.com/m-revision/common/user/queryUserInfo/109114414?userCountKeys=follower
export const reqUserInfo = (userid: any) => {
	return WYapi.get<any, userInfoModel>(
		`https://m.ximalaya.com/m-revision/common/user/queryUserInfo/${userid}?userCountKeys=follower`,
	);
};

// 主播作品
export const reqUserWork = (userid: any) => {
	return WYapi.get<any, userworkModel>(
		`/m-revision/common/anchor/queryAnchorAlbumsByPage?anchorId=${userid}&page=1&pageSize=4&asc=false`,
	);
};
// 用户评论
export const reqCommentList = (id: number) => {
	return WYapi.get<any, commentModel>(
		`/m-revision/common/album/queryAlbumCommentsByPage?page=1&pageSize=10&albumId=${id}&v=1678361487609`,
	);
};
//相似专辑
export const reqAlbum = (title?: string, page?: number, pageSize?: number) => {
	return WYapi.get<any, AlbumModel>(
		`/revision/search/seo?kw=${title}&page=${page}&rows=${pageSize}&device=iPhone&condition=re
		lation&spellchecker=true&core=album`,
	);
};
// 猜你喜欢
export const reqLikeList = () => {
	return WYapi.get<any, LikeListModel>(
		`/revision/category/v2/albums?pageNum=1&pageSize=5&sort=1`,
	);
};
